//
//  FactoryParser.m
//  工厂模式
//
//  Created by macOS on 2017/4/20.
//  Copyright © 2017年 macOS. All rights reserved.
//

#import "FactoryParser.h"


@interface FactoryParser ()<NSXMLParserDelegate>

@property (nonatomic , strong) NSMutableDictionary *dict;


@end

@implementation FactoryParser



- (NSMutableDictionary *)parser{
  
    NSString *url = [[NSBundle mainBundle] pathForResource:@"VGConfig" ofType:@"xml"];
    
    NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:[NSURL URLWithString:url]];
    xmlParser.delegate = self;
    
    
    [xmlParser parse];
    
    
    
    return _dict;
    
}


- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary<NSString *,NSString *> *)attributeDict{

    if ([elementName isEqualToString:@"bean"]) {
        
        NSString *chose =  attributeDict[@"chose"];
        NSString *className = attributeDict[@"class"];
        _dict[chose] = className;
        
    }
    
   
}

@end
